package com.geely.json;

import com.google.gson.Gson;

import org.junit.Test;

public class MainJson {
    @Test
    public void mainTest() {
        Gson gson = new Gson();
        System.out.println(gson.toJson(1));

        int[] arrInt = {1, 2, 3};
        System.out.println(gson.toJson(arrInt));

        int i = gson.fromJson("1", int.class);
        System.out.println("i:" + i);

        Json json = new Json();
        json.setName("lty");
        json.setAge(0);

        String s = gson.toJson(json);
        System.out.println(s);

        Json fromJson = gson.fromJson(s, Json.class);
        System.out.println(fromJson);
    }
}
